package com.example.othree.entity;

import cn.hutool.core.date.DateTime;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.util.Date;


@Data
@ToString
@AllArgsConstructor
@NoArgsConstructor
@TableName("tower_ozone_gradient_observations_copy1")
public class TowerOzone {

    @TableField(value = "id")
    private Long id;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "Asia/Shanghai")
    @TableField(value = "time")
    private Date time;
    @TableField(value = "PointName")
    private String pointName;
    @TableField(value = "Ma_peak")
    private String MaPeak;
    private double Vmax;
    private double temp;
    @TableField(value = "Ma_wind")
    private double wind1;
    @TableField(value = "Ma_wdir")
    private double wdir1;
    @TableField(value = "US_wind")
    private double wind2;
    @TableField(value = "US_wdir")
    private double wdir2;
    @TableField(value = "US_W")
    private double ww2;
    private double rh;

    // 解析 pointName，提取名称和高度
    public String getLocation() {
        return pointName.replaceAll("\\d+", ""); // 去掉数字部分
    }

    public Integer getHeight() {
        String heightStr = pointName.replaceAll("\\D+", ""); // 去掉非数字部分
        return heightStr.isEmpty() ? null : Integer.parseInt(heightStr);
    }

}
